#include "plug_item.h"
#include <QPainter>

PlugObject::PlugObject(QGraphicsItem *parent , QGraphicsTextItem *carNumberItem ,QString *carIP)
    : QGraphicsItem(parent),
      carNumberItem(carNumberItem),
      carIP(carIP)
{
    this->setAcceptedMouseButtons(Qt::LeftButton);
    this->setFlag(QGraphicsItem::ItemIsSelectable,false);
    this->setZValue(-2);
    this->Color_0 = QColor(244, 96, 108);
    this->Color_1 = QColor(190, 237, 199);
    this->Color_2 = QColor(230, 206, 172);
    this->Color_3 = QColor(25, 202, 173);
    this->myplugcolor = Color_0;
    this->isAtOringin = false;
    this->isMoving = false;
    this->isConnected = false;
};
PlugObject::~PlugObject()
{

}


QRectF PlugObject::boundingRect() const
{
    return QRectF(-15,-20,30,40);
}


void PlugObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);

    painter->setBrush(myplugcolor);
    painter->drawRect(boundingRect());

}
